<?php
use Fox\Html\Button;
use Fox\Html\TextArea;
use Fox\Html\Block;
use Fox\Html\Text;
use Fox\Html\DropList;
use Fox\Html\Screen,Fox\Html\Input;
$xview = Xview::instance();

$screen = new Screen("formContact");
$screen->action(_URL_."contact/contact.html");
$block = new Fox\Html\Block("blContact");
$block->add(new DropList(array("ent_service","targetid"),true,true,true))
		->size(170)
		->label("Service &agrave; contacter");
$block->add(new Input("name1",true))->size(40)->label("Nom et Pr&eacute;nom");
$block->add(new Input("function",false),2,"name1");
$block->add(new Input(array("email","email1"),true))->label("Adresse e-mail");
$block->add(new Input("company",false),2);
$block->add(new Input(array("phone","phone1"),false),2);
$block->add(new Input("subject",true))->label("Sujet");
$block->item("subject")->size(40);
$block->add(new TextArea("message",true))->label("Message");
$screen->add($block);
$screen->add(new Button("send"));

if($screen->submitted() || isset($_POST['subject']))
{
	$inputs = $screen->get();
	if(!$screen->errors())
	{
		$inputs['source'] = 'WS_GROUP';
		try {
			$response = Fox\Services::instance()->service('shama-contact')->call($inputs);
			$response = Fox\Utilities::jsonUTF8Decode($response);
			if(isset($response['error']))
			{
				foreach($response['error'] as $error) {
					throw new Exception($error);
				}
			}
			else
			{
				Fox\Message::Success("Votre Message a &eacute;t&eacute; envoy&eacute;");
				$screen->redirect();
			}
		}
		catch(Exception $e)
		{
			Fox\Message::Error($e->getMessage());
		}
	}
}
$html = '<div class="blockCentral blockCentral-3">
		<div class="blockCentralBottom">
		<div class="blockCentralCenter">
		<div class="blockCentralCenterInner">
		<h2>Nous contacter</h2>
			<div class="formContact">

			';

$html .= $screen->display();
$html .= '</div>
		<div class="mainContact">
				<div class="contact">
					<div class="contact-2" >
						<div class="contact-colum2" style="float:left;">
							<span class="nameCompany">Orinea Recherches &copy;</span>
							<span>56 rue de Londres <br></span>
							<span>75008 Paris - France</span>
							<span><b>Tel</b> : +33 1 56 33 15 43</span>
							<span><b>Mail</b> : <span class="mailcode">info@orinea-recherches.com</span></span>
						</div>

						<div class="contact-colum2" style="float:left;padding-left:50px">
							<span class="nameCompany">Orinea Offshore &copy;</span>
							<span>43 bd d\'Anfa <br></span>
							<span>20200 Casablanca - Maroc</span>
							<span><b>Tel</b> : +212 6 48 86 35 76</span>
							<span><b>Mail</b> : <span class="mailcode">info@orinea-offshore.com</span></span>
						</div>

						<div class="contact-colum1" style="float:left;padding-left:50px">
							<span class="nameCompany">Orinea Solutions &copy;</span>
							<span>56 rue de Londres <br></span>
							<span>75008 Paris - France</span>
							<span><b>Tel</b> : +33 1 56 33 15 43</span>
							<span><b>Mail</b> : <span class="mailcode">info@orinea-solutions.com</span></span>
						</div>


					</div>

				</div>

				<div style="clear: both;"></div>
			</div>
			<div style="clear: both;"></div>
		</div>
		</div>
	</div>
</div>';
return $html;